package com.coin.liu.controller;


import com.coin.liu.Utils.PageUtils;
import com.coin.liu.Utils.ResultResponse;
import com.coin.liu.client.teacherOtherdataClient;
import com.coin.liu.pojo.OtherTeacherData;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;

@Controller
@Scope("prototype")
public class Otherdatacontroller {

   @Autowired
    teacherOtherdataClient teacherOtherdataClient;

    @RequestMapping("/teacher_list")
    @ApiOperation("老师的其他信息分页展示")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "pageIndex",value = "分页的当前页码"),
            @ApiImplicitParam(name = "pageSize",value = "每页显示的条数"),
            @ApiImplicitParam(name = "PageUtils",value = "这是一个工具包,其中包括.pageindex,pagesize,totalcount(数据的总条数),records(当前页的所有数据),numberstart(开始的页码序号),numberend(页码的结束序号)," +
                    "所有数据封装到pageutils，传到前端取出其中需要的数据即可"),
            @ApiImplicitParam(name = "idCard",value = "根据身份证号查询传入的身份证号")
    })
    public String getteacherList(Long page,Long limit, @RequestParam(value = "idCard",defaultValue = "") String idCard, Model model){

        PageUtils<OtherTeacherData> otherTeacherDataPageUtils = teacherOtherdataClient.getteacherList(page, limit, idCard);
        model.addAttribute("otherTeacherDataPageUtils",otherTeacherDataPageUtils);
        model.addAttribute("idCard",idCard);
         return "redirect:/studentBasicData";

    }

    @RequestMapping("/teacherinfo_add")
   @ResponseBody
    public void add( OtherTeacherData otherTeacherData){

        System.out.println(otherTeacherData);
        teacherOtherdataClient.teacherinfoadd(otherTeacherData);

   }
}
